-
Couldn't load subscription status.
- Fork 522
#6344 - In Course>Users>Usergroups, add a action button for usergroups to have the preview list members #6880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| } | ||
| } | ||
|
|
||
| public function unsubscribe_only_courses_from_usergroup($usergroup_id, $delete_items, $sessionId = 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHPDoc block needed to document the method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method should provide a return type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, please try using even more the code from src/ rather than using code from legacy libraries. This will help us move faster to remove/migrate all legacy code.
Please see and attend change requests before we merge.
| $groupId = isset($_GET['id']) ? (int) $_GET['id'] : 0; | ||
| foreach ($delete_items as $course_id) { | ||
| $course_info = api_get_course_info_by_id($course_id); | ||
| if ($course_info) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is inefficient. api_get_course_info_by_id() is a heavy function. Please just replace by a validation that $course_id is an int, and that should be enough (worst case: the course_id is not present in usergroup_rel_course and the delete fails but does not break the process).
| ); | ||
| } | ||
| if (0 != $sessionId && 0 != $groupId) { | ||
| $this->subscribe_sessions_to_usergroup($groupId, [0]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You cannot add a "subscribe*()" call inside a method that is called "unsubscribe_only_courses_from_usergroup()". What is the goal here ?
| if (0 != $sessionId && 0 != $groupId) { | ||
| $this->subscribe_sessions_to_usergroup($groupId, [0]); | ||
| } else { | ||
| $s = $sessionId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This $s is never used. It should either be removed or used and documented.
| @@ -0,0 +1,72 @@ | |||
| <?php | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a Helper
| @@ -0,0 +1,30 @@ | |||
| <?php | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code should go into a new file called UsergroupController.php rather than ClassController.php (we don't use the term "Class" in the code anymore).
| /** | ||
| * @author Julio Montoya <[email protected]> | ||
| */ | ||
| #[Route('/user')] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing /user is not a super nice idea. Better leave it and use /user/overview as path for overview().
Paths with "main" are only kept until all the legacy code is migrated to Vue
| @@ -0,0 +1,98 @@ | |||
| {% extends "@ChamiloCore/Layout/base-layout.html.twig" %} | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move to src/CoreBundle/Resources/views/Usergroup/overview.html.twig
See #6344
the goal is to allow teachers to quickly have a full users list page of members of a class registered to a course.
It is a very simple and basic overview page with